import axios from "axios"
import qs from 'qs'
export const axiosRequests = () => {
    axios.defaults.baseURL = 'http://localhost:3100';//设置基址
    //这是post调用
    let userpost = async (href: string, data: any) => {
        let result = await axios.post(href, qs.stringify(data), {
            headers: {
                Authorization: localStorage.getItem('token') || ' ',
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        })
        return result.data
    }
    let userget = async (href: string, data: any) => {
        let result = await axios.get(href, data)
        return result.data
    }
    return {
        userpost,
        userget,
    }
}